public class ListDemo3 {
    public static void main(String[] args) {
        List<Integer> List = new ArrayList<>();
        for(int i = 0;i<10;i++){
            List.add(i);
        }
        System.out.println(list);
        List<Integer>subList = List.subList(2,5);
        System.out.println(subList);
        for(int i = 0;i<subList.size();i++){
            int num=subList.get(i);
            num=num*2;
            System.out.println(subList);
            System.out.println(List);
        }

        System.out.println(List);
        list.subList(2,5).clear();
        System.out.println(list);
    }
}
